00001 /////////////////////////////////////////////////////////////////////////////// 00002 /// @file de2D.hpp 00003 /// 00004 /// @brief 2D Overlays and other 2D drawing 00005 /// 00006 /// @author Assassin 00007 /// 00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the 00009 /// contents of this file is subject to the Destiny3D Member License which 00010 /// can be found at http://www.destiny3d.com. Any other usage is prohibited. 00011 /// 00012 /// This file is distributed "AS IS" without warranty of any kind. Novus 00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file 00014 /// for any particular purpose. 00015 /// 00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved. 00017 /// 00018 /// <hr> 00019 /// Change History 00020 /// <hr> 00021 /// 00022 /// @date Mar 2002 00023 /// @author Assassin 00024 /// @remarks Creation 00025 /// 00026 /// @date May 2002 00027 /// @author Assassin 00028 /// @remarks Interface implementation 00029 /// 00030 /////////////////////////////////////////////////////////////////////////////// 00031 00032 #ifndef DE2D_HPP 00033 #define DE2D_HPP 00034 00035 #include "deGlobalTypes.hpp" 00036 #include "deRender.hpp" 00037 #include "deMath.hpp" 00038 00039 #if defined(DE2D_DLL_EXPORTS) || defined(DESTINY3D_EXPORT_ALL) 00040 # define DE2D_API extern "C" DEDLL_EXPORT 00041 #elif defined(DESTINY3D_STATIC_LINK) 00042 # define DE2D_API extern "C" 00043 #else 00044 # define DE2D_API extern "C" DEDLL_IMPORT 00045 #endif 00046 00047 #ifdef USING_DESTINY3D 00048 #ifdef _DEBUG 00049 # ifdef DESTINY3D_STATIC_LINK 00050 # pragma comment(lib, "de2D_sd") 00051 # else 00052 # pragma comment(lib, "de2Dd") 00053 # endif //DESTINY3D_STATIC_LINK 00054 #else 00055 # ifdef DESTINY3D_STATIC_LINK 00056 # pragma comment(lib, "de2D_s") 00057 # else 00058 # pragma comment(lib, "de2D") 00059 # endif //DESTINY3D_STATIC_LINK 00060 #endif //_DEBUG 00061 #endif //USING_DESTINY3D 00062 00063 class Ide2DObject; 00064 class Ide2DCollection; 00065 class IdeRenderTexture; 00066 class IdeVertexBuffer; 00067 class IdeCamera; 00068 class IdeDriver; 00069 00070 // factory functions 00071 /// create an instance of Ide2DCollection 00072 DE2D_API Ide2DCollection* Ide2DObject_Create2DCollection(); 00073 /// create an instance of Ide2DObject using a vertex buffer 00074 DE2D_API Ide2DObject* Ide2DObject_Create2DObject( IdeVertexBuffer * VBuffer, 00075 IdeRenderTexture * Texture, deFloat Depth = 10.0f, 00076 deBoolean ExpireNow = deFALSE); 00077 /// create an instance of Ide2DObject using a rectangle to form an overlay 00078 DE2D_API Ide2DObject* Ide2DObject_Create2DOverlay( deRect *ScreenRect, 00079 deFloatRect *TexCoords, IdeRenderTexture * Texture, 00080 deFloat Depth = 10.0f, deARGB color = 0xFFFFFFFF, 00081 deDouble FadePerSecond = 0.0); 00082 /// create an instance of Ide2DObject to act as a corona 00083 DE2D_API Ide2DObject* Ide2DObject_Create2DCorona( deRect *SizeRect, 00084 deFloatRect *TexCoords, IdeRenderTexture * Texture, 00085 IdeCamera * ScreenCamera, deFloat Depth = 10.0f, 00086 deARGB color = 0xFFFFFFFF); 00087 /// create an instance of Ide2DObject using a line segment 00088 DE2D_API Ide2DObject* Ide2DObject_Create2DLine( deVec3d Start, deVec3d End, 00089 deARGB color = 0xFFFFFFFF, deDouble FadePerSecond = 0.0, 00090 deFloat Depth = 10.0f); 00091 /// create an instance of Ide2DObject using several line segments 00092 DE2D_API Ide2DObject* Ide2DObject_Create2DLineList( deVec3d PointList[], 00093 long NumPoints, deARGB color = 0xFFFFFFFF, 00094 deDouble FadePerSecond = 0.0, deFloat Depth = 10.0f); 00095 /// create an instance of Ide2DObject using a rectangle to form lines 00096 DE2D_API Ide2DObject* Ide2DObject_Create2DLineRect( deRect & LineRect, 00097 deARGB color = 0xFFFFFFFF, deDouble FadePerSecond = 0.0, 00098 deFloat Depth = 10.0f); 00099 00100 /// base class for handling objects rendered in 2D. 00101 /// Related functions: Ide2DObject_Create2DObject, Ide2DObject_Create2DOverlay, Ide2DObject_Create2DCorona 00102 /// Ide2DObject_Create2DLine, Ide2DObject_Create2DLineList, Ide2DObject_Create2DLineRect. 00103 /// Related classes: Ide2DCollection. 00104 //class Ide2DObject : virtual public IdeRefCountBase 00105 DE3D_INTERFACE(Ide2DObject, IdeRefCountBase) 00106 { 00107 protected: 00108 // cannot instantiate this class on stack or with new 00109 virtual ~Ide2DObject() {} 00110 public: 00111 /// Get the internal vertex buffer for this object 00112 virtual IdeVertexBuffer * GetVBuffer() const = 0; 00113 /// Get the texture-state used to render this object 00114 virtual IdeRenderTexture* GetTexture() const = 0; 00115 // used internally 00116 virtual deBoolean HasExpired() const = 0; 00117 /// Get the depth value used for sorting this object into the render order. 00118 /// Note that the depth value is only relative to other objects and collections inside the same collection. 00119 virtual deFloat GetDepth() const = 0; 00120 00121 /// Cause this object to be deleted after it is next rendered 00122 virtual void MakeExpire() = 0; 00123 /// Set the depth value used for sorting this object into the render order. 00124 /// Note that the depth value is only relative to other objects and collections inside the same collection. 00125 /// Calling this method on an object already in a collection will not change its rendering order. 00126 /// Instead, call Ide2DCollection::AdjustObjectDepth which will invoke this method on the 2d object. 00127 virtual deBoolean SetDepth(deFloat Depth) = 0; 00128 00129 /// Manually transform the position values in the internal vertex buffer, to move the object. 00130 virtual deBoolean Move(deVertex DeltaXY) = 0; 00131 virtual deBoolean Update(deDouble DeltaTime) = 0; 00132 }; 00133 00134 /// Used to collect 2D objects together and render them to the screen. 00135 /// Related functions: Ide2DObject_Create2DCollection. 00136 /// Related classes: Ide2DObject. 00137 //class Ide2DCollection : virtual public IdeRefCountBase 00138 DE3D_INTERFACE(Ide2DCollection, IdeRefCountBase) 00139 { 00140 protected: 00141 // cannot instantiate this class on stack or with new 00142 virtual ~Ide2DCollection() {} 00143 virtual void SetParent(Ide2DCollection* ParentCollection) = 0; 00144 public: 00145 /// Get the rect used for clipping objects 00146 virtual const deRect& GetRect() const = 0; 00147 /// Set the rect used for clipping objects 00148 virtual void SetRect(deRect &rect) = 0; 00149 00150 /// Set the background color for this collection. You may specify alpha (0xff = opaque). 00151 virtual void SetBGColor(deARGB color) = 0; 00152 /// Get the background color for this collection 00153 virtual deARGB GetBGColor() = 0; 00154 00155 /// Enable or disable a collection from rendering. 00156 /// Can be used in windowing systems to "minimize" the collection. 00157 virtual void SetEnabled(deBoolean Enable) = 0; 00158 /// Get the rendering-enabled status of the collection 00159 virtual deBoolean IsEnabled() const = 0; 00160 00161 /// Get the X & Y scroll offsets currently being used for this collection 00162 virtual void GetScrollValue(deVec3d & scroll) const = 0; 00163 /// Set the X & Y scroll offsets for this collection 00164 virtual void SetScrollValue(const deVec3d & scroll) = 0; 00165 00166 /// Add a 2D object to this collection, so it may be rendered. 00167 /// This method invokes object->Claim() to increment the object's reference count. 00168 virtual deBoolean AddObject(Ide2DObject * object) = 0; 00169 /// Remove a 2D object from this collection. 00170 /// This method invokes object->Release() to decrement the object's reference count, 00171 /// possibly causing destruction. 00172 virtual deBoolean RemoveObject(Ide2DObject * object) = 0; 00173 /// Adjust the depth value of a 2D object. 00174 /// This method invokes object->SetDepth(Depth). 00175 virtual deBoolean AdjustObjectDepth(Ide2DObject * object, deFloat Depth) = 0; 00176 00177 /// Add a subordinate 2D collection to this one, so that its contents be rendered 00178 /// inside the extents of this one. 00179 /// This method invokes collection->Claim(). 00180 virtual deBoolean AddSubCollection(Ide2DCollection * collection) = 0; 00181 /// Remove a subordinate 2D collection. 00182 /// This method invokes collection->Release(). 00183 virtual deBoolean RemoveSubCollection(Ide2DCollection * collection) = 0; 00184 /// Get the depth value used for sorting this collection into the render order. 00185 /// Note that the depth value is only relative to other objects and collections inside the same collection. 00186 virtual deFloat GetDepth() const = 0; 00187 /// Set the depth value used for sorting this collection into the render order. 00188 /// Note that the depth value is only relative to other objects and collections inside the same collection. 00189 /// This method, unlike Ide2DObject::SetDepth, will adjust the rendering order of this collection. 00190 virtual deBoolean SetDepth(deFloat Depth) = 0; 00191 00192 /// Render all the objects and sub-collections contained by this collection. 00193 /// It is recommended that a user not call this explicitly, instead letting IdeRender handle this task. 00194 /// IdeRender::EndFrame invokes Ide2DCollection::Render for its attached 2d collection. 00195 virtual deBoolean Render( IdeDriver * Driver, deDouble DeltaTime, 00196 IdeRenderTexture *NullTex, IdeRender::deRenderStats * RenderStats, 00197 deBoolean DoOcclusion = deFALSE) = 0; 00198 00199 /// Destroy all the objects, and optionally all the sub-collections, contained by this collection. 00200 /// All destroyed sub-collections will also destroy their own sub-collections. 00201 virtual void DestroyAllObjects(deBoolean SubCollectionsAlso = deTRUE) = 0; 00202 }; 00203 00204 #endif 00205
1.3-rc3